cc.Class({
    extends: cc.Component,

    properties: {
        All_mail: cc.SpriteAtlas,
        title: cc.Label,
        date: cc.Label,
        mail_icon: cc.Sprite,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start() {

    },
    init(data) {
        this.id=data.id;
        this.title.string=data.title;
        this.date.string=data.date;
    },
    /** 更改邮件的状态 1 为打开 其他为没有打开
     * time 2019/8/30
     * author:zzw
     * dsc:
     */
    changeState(num) {
        if (num === 1) {
            this.mail_icon.getComponent(cc.Sprite).spriteFrame = this.All_mail.getSpriteFrame("icn_sel_opened")
        } else {
            this.mail_icon.getComponent(cc.Sprite).spriteFrame = this.All_mail.getSpriteFrame("icn_nor_no");
        }
    },
    click() {
        var _event = new cc.Event.EventCustom('foobar', true);
        _event.detail = {
            id: this.id,
        };

        this.node.dispatchEvent(_event);

    },
    // update (dt) {},
});
